import request from '@/hooks/request'

const Api = {
  goodList: '/commerce/product/getCommerceProductList', // 获取商品列表
  getWechatRobotListAdmin: '/platform/wechatRobot/getWechatRobotListAdmin', // 查询微信列表(管理员)
  getFishRobotListAdmin: '/platform/fish/getFishRobotListAdmin', //  查询闲鱼列表(管理员)
  putawayProduct: '/fish/product/putAwayCommerceProduct', //  实物电商发布到闲鱼商品
  ProductCate: '/commerce/product/getProductCateList', // 查询实物商品分类
  fishCateGoryList: '/fish/product/getFishCateList', //获取闲鱼的类目
  fisrtCategoryList: '/fish/product/bizTypeList', //获取行业列表 (相当于第一级类目)
  FishPvChildrenList: '/fish/product/getFishPvChildrenList', //查询闲鱼pv属性列表
  getFishPvList: '/fish/product/getFishPvList', //查询闲鱼PV列表
  FishCateByFishCateIdList: '/fish/product/getFishCateByFishCateIdList', //获取闲鱼四级类目
  fishAccount: '/platform/fish/getPutawayProductRobotList', //获取闲鱼账号列表
}
export const getFishAccount = () => {
  return request({
    method: 'post',
    url: Api.fishAccount,
  })
}
export const getFishCateByFishCateIdList = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('fishCateId', parameter.fishCateId)
  return request({
    method: 'post',
    url: Api.FishCateByFishCateIdList,
    data: formData,
  })
}
export const getFishPvChildrenList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.FishPvChildrenList,
    data: parameter,
  })
}
export const GetFishPvList = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('cateId', parameter.cateId)
  return request({
    method: 'post',
    url: Api.getFishPvList,
    data: formData,
  })
}
export const getFirstbizTypeList = () => {
  return request({
    method: 'post',
    url: Api.fisrtCategoryList,
  })
}
export const getCateGoryList = (parameter: Record<any, any>) => {
  const formData = new FormData()
  // formData.append('parentCateId', parameter.parentCateId)
  return request({
    method: 'post',
    url: Api.fishCateGoryList,
    data: parameter,
    // data: formData,
  })
}

export const getProductCateList = () => {
  return request({
    method: 'post',
    url: Api.ProductCate,
  })
}
//发布商品
export const putawayProducts = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.putawayProduct,
    data: parameter,
  })
}
export const getGoodsList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.goodList,
    data: parameter,
  })
}

export const getWechatRobotListAdmin = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getWechatRobotListAdmin,
    data: parameter,
  })
}

export const getFishRobotListAdmin = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getFishRobotListAdmin,
    data: parameter,
  })
}
